const fs = require('fs');
const path = require('path');

function copyJsonFiles() {
    const srcPath = path.join(__dirname, '..', 'src');
    const distPath = path.join(__dirname, '..', 'dist');
    
    function copyRecursive(src, dest) {
        if (!fs.existsSync(dest)) {
            fs.mkdirSync(dest, { recursive: true });
        }
        
        const items = fs.readdirSync(src);
        
        for (const item of items) {
            const srcItem = path.join(src, item);
            const destItem = path.join(dest, item);
            const stat = fs.statSync(srcItem);
            
            if (stat.isDirectory()) {
                copyRecursive(srcItem, destItem);
            } else if (item.endsWith('.json')) {
                fs.copyFileSync(srcItem, destItem);
                console.log(`📄 复制: ${path.relative(srcPath, srcItem)} -> ${path.relative(distPath, destItem)}`);
            }
        }
    }
    
    copyRecursive(srcPath, distPath);
    console.log('✅ JSON 文件复制完成');
}

copyJsonFiles(); 